package com.mzy.basics.utils.Io;

import java.io.File;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/4/12 15:00
 * @Version 1.0
 */
public class DeleteFile {

    public static void main(String[] args) {
//        delFile()
    }

    /**
     * 删除文件及目录
     * @param file;
     */
    public static boolean delFile(File file) {
        if (!file.exists()) {
            return false;
        }

        if (file.isDirectory()) {
            File[] files = file.listFiles();
            for (File f : files) {
                delFile(f);
            }
        }
        return file.delete();
    }
}
